using DotNetNuke.Services.Exceptions;
using System;

namespace DotNetNuke.Modules.DNNWeather
{
    /// <summary>
    /// The EditDNNWeather class is used to manage content
    ///
    /// Typically your edit control would be used to create new content, or edit existing content
    /// within your module. The ControlKey for this control is "Edit", and is defined in the
    /// manifest (.dnn) file.
    ///
    /// Because the control inherits from DNNWeatherModuleBase you have access to any custom
    /// properties defined there, as well as properties from DNN such as PortalId, ModuleId, TabId,
    /// UserId and many more.
    /// </summary>
    public partial class Edit : DNNWeatherModuleBase
    {
        #region Event Handlers

        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Init" /> event.
        /// </summary>
        /// <param name="e">
        /// An <see cref="T:System.EventArgs" /> object that contains the event data.
        /// </param>
        override protected void OnInit(EventArgs e)
        {
            InitializeComponent();
            base.OnInit(e);
        }

        private void InitializeComponent()
        {
            this.Load += new System.EventHandler(this.Page_Load);
        }

        /// <summary>
        /// Page_Load runs when the control is loaded
        /// </summary>
        private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                //Implement your edit logic for your module
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }

        #endregion Event Handlers
    }
}